package com.stoneframe.util.baseApp;

import java.util.HashMap;
import java.util.Map;

import org.codehaus.jackson.map.util.JSONPObject;

public class AppHelper {
	
	public static Object returnObject(PageData pd,Object map){
		if(pd!=null && pd.containsKey("callback")){
			String callback=pd.get("callback").toString();
			return new JSONPObject(callback, map);
		}
		return map;
	}
	
	public static Object successObject(Object obj){
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("type", "0");
		map.put("message", "操作成功！");
		map.put("rows", obj);
		return map;
	}
	
	public static Object errorObject(Object obj){
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("type", "-1");
		map.put("message", obj);
		return map;
	}

}
